import subprocess
import sys
-profile = sys.argv[1]
+repodir = sys.argv[1]
+profile = sys.argv[2]
sys.stdout.write("/* This file is auto-generated. Do not edit. */\n")
sys.stdout.write("#pragma once\n")
sys.stdout.write(f"#define PROFILE \"{profile}\"\n")
short_sha = os.environ.get('CI_COMMIT_SHORT_SHA')
-if short_sha is not None:
- sys.stdout.write(f"#define VCS_TAG \"{short_sha}\"\n")
-else:
- cmd = ["git", "rev-parse", "--short", "HEAD"]
- with subprocess.Popen(cmd, stdout=subprocess.PIPE) as p:
- short_sha = p.stdout.read().decode('utf-8').rstrip("\n")
- sys.stdout.write(f"#define VCS_TAG \"{short_sha}\"\n")
+if short_sha is None:
+ cmd = ["git", "-C", repodir, "rev-parse", "--short", "HEAD"]
+ try:
+ with subprocess.Popen(cmd, stdout=subprocess.PIPE) as p:
+ short_sha = p.stdout.read().decode('utf-8').rstrip("\n")
+ except FileNotFoundError:
+ short_sha = ''
+ if profile != 'default':
+ short_sha = 'devel'
+
+sys.stdout.write(f"#define VCS_TAG \"{short_sha}\"\n")
demo_conf_h = declare_dependency(
sources: custom_target('demo-header',
- command: [gen_demo_header, demo_profile],
+ command: [gen_demo_header, meson.source_root(), demo_profile],
capture: true,
output: 'demo_conf.h',
build_by_default: true,